package com.bingqing.service;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.unit.DataUnit;
import com.bingqing.dao.HotelDao;
import com.bingqing.dao.ReserveDao;
import com.bingqing.entity.Hotel;
import com.bingqing.entity.Params;
import com.bingqing.entity.Reserve;
import com.bingqing.exception.CustomException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: TypeService
 * Package: com.bingqing.service
 * Description:
 *
 * @Author liuyujie
 * @Create 2024-03-10 9:23
 * @Version 1.0
 */
@Service
public class ReserveService {
    @Resource
    ReserveDao reserveDao;


    //分页查询
    public PageInfo<Reserve> findBySearch(Params params) {
        PageHelper.startPage(params.getPageNum(),params.getPageSize());
        List<Reserve> list=  reserveDao.findBySearch(params);
        return PageInfo.of(list);
    }


    public void add(Reserve reserve) {
        reserveDao.insertSelective(reserve);
    }


    public void deleteById(Integer id) {
        reserveDao.deleteByPrimaryKey(id);
    }
}
